<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: left;">
<a href="<?php echo( base_url() ); ?>cmb/member/home/<?php echo( $urlKey ); ?>/" target="_self">Existing Member Home</a>
</div>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );

	echo( form_open(base_url() . 'cmb/member_registration/register_existing_member_process/'. $urlKey . '/', array('id' => 'registerExistingForm') ) );
		//Primary member info
		Spacer::Render(0, 50);
		echo('<b>Primary Member Info</b>');
		echo('<hr />');
		Form::OpenFormItemSummary('Primary Member Name:', 260);
			echo( form_label($accountinfo->getFirstName() . ' ' . $accountinfo->getLastName(), 'primaryfirstname', 'style="width: 20px;" ') );
		Form::CloseFormItem();
		Form::OpenFormItemSummary('Primary Member Gender:', 260);
			echo( form_label($accountinfo->getGender(), 'primarygender', 'style="width: 20px;" ') );
		Form::CloseFormItem();
				
		//Spouse info
		if($accountinfo->getSpouseFirstName() != "")
		{
			Spacer::Render(0, 20);
			echo('<b>Spouse Info</b>');
			echo('<hr />');
			Form::OpenFormItemSummary('Spouse Name:', 260);
				echo( form_label($accountinfo->getSpouseFirstName() . ' ' . $accountinfo->getSpouseLastName(), 'spousefirstname', 'style="width: 20px;" ') );
			Form::CloseFormItem();
			
			Form::OpenFormItemSummary('Spouse Gender:', 260);
				echo( form_label($accountinfo->getSpouseGender(), 'spousegender', 'style="width: 20px;" ') );
			Form::CloseFormItem();
		} //if($accountinfo->getSpouseFirstName() != "")
			
		//Household info
		Spacer::Render(0, 20);
		echo('<b>Household Info</b>');
		echo('<hr />');
		Form::OpenFormItemSummary('CMB Center:', 260);
				echo( form_label($accountinfo->getCMBCenter(), 'center', 'style="width: 20px;" ') );
		Form::CloseFormItem();			
		
		if($accountinfo->getCMBCenter() == "Andover")
		{		
			Form::OpenFormItem('Preferred Satsang Session*:</br><a href="https://www.cmbmembersstage.org/cmb/member_info/satsangh_importance/" target="_blank"><font size="1">Importance of Satsang</font></a>', 260);
				$satsangOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                //echo( form_label($accountinfo->getSession(), 'satsang', 'style="width: 20px;" ') );
				echo( form_dropdown('primaryAttendSatsang', $satsangOptions, $accountinfo->getSession(), 'id="primaryAttendSatsang" style="width: 75px;" ') );
			Form::CloseFormItem();	
		}

        //Session info
        //----------------------------------------      
        Spacer::Render(0, 40);
        echo('<b>Session Info</b>');
        Spacer::Render(0, 5);
        echo('<hr />');
        if($accountinfo->getCMBCenter() == "Andover")
        {       
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 0 0 0px 2px;">');
            echo('<caption><center><b>Satsang Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspAM&nbsp</center></td><td><center>&nbsp9:00am - 10:30am&nbsp</center></td></tr>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp11:45am - 1:15pm&nbsp</center></td></tr>');
            echo('<tr><td><center>&nbspPM2&nbsp</center></td><td><center>&nbsp2:15pm - 3:45pm&nbsp</center></td></tr>');
            echo('</table>');
            Spacer::Render(0, 100);
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 10px 0 0 2px;">');
            echo('<caption><center><b>Balavihar Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<th><center><b>&nbspGrades&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspAM&nbsp</center></td><td><center>&nbsp9:00am - 10:30am&nbsp</center></td><td><center>&nbspPreK - 12&nbsp</center></td></tr>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp11:45am - 1:15pm&nbsp</center></td><td><center>&nbspPreK - 9&nbsp</center></td></tr>');
            echo('<tr><td><center>&nbspPM2&nbsp</center></td><td><center>&nbsp2:15pm - 3:45pm&nbsp</center></td><td><center>&nbspPreK - 8&nbsp</center></td></tr>');
            echo('</table>');
            Spacer::Render(0, 100);
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 10px 0 0px 2px;">');
            echo('<caption><center><b>Language Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspAM&nbsp</center></td><td><center>&nbsp10:30am - 11:30am&nbsp</center></td></tr>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp1:15pm - 2:15pm&nbsp</center></td></tr>');
            echo('</table>');        }
        else
        {
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 0 0 0px 2px;">');
            echo('<caption><center><b>Satsang Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp3:30pm - 5:00pm&nbsp</center></td></tr>');
            echo('</table>');
            Spacer::Render(0, 100);
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 10px 0 0 2px;">');
            echo('<caption><center><b>Balavihar Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<th><center><b>&nbspGrades&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp3:30pm - 5:00pm&nbsp</center></td><td><center>&nbspPreK - 12&nbsp</center></td></tr>');
            echo('</table>');
            Spacer::Render(0, 100);
            echo('<table border="1" style="clear: left; display: block; float: left; margin: 10px 0 0px 2px;">');
            echo('<caption><center><b>Language Timing</b></center></caption>');
            echo('<th><center><b>&nbspSession&nbsp</b></center></th>');
            echo('<th><center><b>&nbspTime&nbsp</b></center></th>');
            echo('<tr><td><center>&nbspPM&nbsp</center></td><td><center>&nbsp2:30pm - 3:30pm&nbsp</center></td></tr>');
            echo('</table>');        
        }

        Spacer::Render(0, 120);

		//Children registered for Balavihar		
		$numChildren = count($accountinfo->getChildInfo());
		$numEnabledChildren = 0;
		if($numChildren > 0)
		{
			Spacer::Render(0, 20);
	
			echo('<b>Re-Register Children for Balavihar</b>');
			echo('<hr />');
		
			$childInfoArray = $accountinfo->getChildInfo();
			$childLangArray = $accountinfo->getChildLang();
			$childLangLevelArray = $accountinfo->getChildLangLevel();
			
			$i = 0;
            $bvsession = $accountinfo->getSession();
			for( $k = 0; $k < $numChildren; $k++ )
			{
				$childInfoRes = $childInfoArray[$k];
				
				//Only show children enabled in bv_reg_history
				if ($childInfoRes[7] == "1")
				{
					$bvsession = $childInfoRes[6];
					Form::OpenFormItemSummary('Child #' . ($i+1) . ' - remove from Balavihar:', 300);
						$remove = 'childRemove'.($i+1);
						$remOptions = array('No'=>'No', 'Yes'=>'Yes');
						echo( form_dropdown($remove, $remOptions, '', 'id="'.$remove.'" style="width: 75px;" ') );
					Form::CloseFormItem();
					Form::OpenFormItemSummary('Child #' . ($i+1) . ' Name:', 300);
						echo( form_label($childInfoRes[0] . ' ' . $childInfoRes[1], 'seva', 'style="width: 20px;" ') );
					Form::CloseFormItem();
					Form::OpenFormItemSummary('Child #' . ($i+1) . ' Gender:', 300);
						echo( form_label($childInfoRes[2], 'seva', 'style="width: 20px;" ') );
					Form::CloseFormItem();
					//Form::OpenFormItemSummary('Child #' . ($i+1) . ' Email:', 300);
						//echo( form_label($childInfoRes[3], 'seva', 'style="width: 20px;" ') );
					//Form::CloseFormItem();
									
					Form::OpenFormItem('Child #'.($i+1).' Email:', 300);
						echo( form_input(array('name'=>'existChildEmail'.($i+1),'id'=>'existChildEmail'.($i+1),'value'=>$childInfoRes[3],'style'=>'width: 250px;')) );
					Form::CloseFormItem();

					Form::OpenFormItem('Child #'.($i+1).' Date Of Birth*:', 300);
						echo( form_input(array('name'=>'existChildDOB'.($i+1),'id'=>'existChildDOB'.($i+1),'value'=>$childInfoRes[4],'style'=>'width: 100px;')) );
						echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"existChildDOB'.($i+1).'":"m-sl-d-sl-Y"} } );</script>' );
					Form::CloseFormItem();
				
					//Form::OpenFormItemSummary('Child #' . ($i+1) . ' DOB:', 300);
						//echo( form_label(substr($childInfoRes[4],0,10), 'seva', 'style="width: 20px;" ') );
					//Form::CloseFormItem();
					Spacer::Render(0, 3);
					Form::OpenFormItemSummary('Child #' . ($i+1) . ' Grade:*', 300);
						if (($childInfoRes[5] == 'Pre-K') or ($childInfoRes[5] == 'K'))
						{
							if ($childInfoRes[5] == 'Pre-K')
								$gradeval = 'K';
							else
								$gradeval = '1';	
						}
						else
						{
							$gradeval = intval($childInfoRes[5]);
							if ($gradeval > 0)
							{
								if ($gradeval < 12)
									$gradeval++;
							}
						}
						$gradeid = 'childGrade'.($i+1);
						$gradeOptions = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');				
						echo( form_dropdown($gradeid, $gradeOptions, strval($gradeval), 'id="'.$gradeid.'" style="width: 75px;"') );
					Form::CloseFormItem();
					Spacer::Render(0, 2);
					if($accountinfo->getCMBCenter() == "Andover")
					{
						Form::OpenFormItemSummary('Child #' . ($i+1) . ' Preferred Balavihar Session:* </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
							$sess = 'childSession'.($i+1);
							$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                            //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
							echo( form_dropdown($sess, $bvSessionOptions, $childInfoRes[6], 'id="'.$sess.'" style="width: 75px;" ') );
						Form::CloseFormItem();
					}
					Spacer::Render(0, 10);
					/* Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language:', 300);
						$langid = 'childLang'.($i+1);
						$langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
						echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
					Form::CloseFormItem();
					Spacer::Render(0, 2);
					Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language Level:', 300);
						$llid = 'childLangLevel'.($i+1);
						$langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
						echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
					Form::CloseFormItem();
                    Spacer::Render(0, 2); */
                    if($accountinfo->getCMBCenter() == "Andover")
                    {
                        Spacer::Render(0, 10);
                        Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language </br><font size="2" color="red">(only Telugu and Hindi languages are offered in the PM2 language session)</font>:', 300);
                            $langid = 'childLang'.($i+1);
                            $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                            echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                        Form::CloseFormItem();
                        Spacer::Render(0, 2);
                        Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language Level:', 300);
                            $llid = 'childLangLevel'.($i+1);
                            $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                            echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                        Form::CloseFormItem();
                        Spacer::Render(0, 2);                    
                        Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language Session:*', 300);
                            $sess = 'childLangSession'.($i+1);
                            $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                            //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                            echo( form_dropdown($sess, $bvSessionOptions, $childInfoRes[6], 'id="'.$sess.'" style="width: 75px;" ') );
                        Form::CloseFormItem();
                    }
                    else
                    {
                        Spacer::Render(0, 10);
                        Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language:', 300);
                            $langid = 'childLangmw'.($i+1);
                            $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                            echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                        Form::CloseFormItem();
                        Spacer::Render(0, 2);
                        Form::OpenFormItemSummary('Child #' . ($i+1) . ' Language Level:', 300);
                            $llid = 'childLangLevelmw'.($i+1);
                            $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                            echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                        Form::CloseFormItem();
                        Spacer::Render(0, 2);                    
                    }
					echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			
					Spacer::Render(0, 20);
				
					$i ++;
				} //if ($childInfoRes[7] == "1")
			}
			
			$numEnabledChildren = $i;
		} //if($numChildren > 0)
		
		//Additional children
		if ((6-$numEnabledChildren) > 0)
		{
			Spacer::Render(0, 20);
			echo('<b>Add Children for Balavihar (optional)</b>');
			echo('<hr />');
			Form::OpenFormItem('Number of additional children for Balavihar:', 300);
				$numChildrenOptions = array();
				$numChildrenOptions[""] = "None";
				for( $i = 0; $i < (6-$numEnabledChildren); $i++ )
				{
					$numChildrenOptions[($i+1)] = strval($i+1);
				}
				//$numChildrenOptions = array(''=>'None','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6');
				echo( form_dropdown('numChildren', $numChildrenOptions, '', 'id="numChildren" style="width: 75px;" onchange="numChildrenChangeHandler();"') );
			Form::CloseFormItem();
		
			Spacer::Render(0, 12);
		
			echo('<div id="child1" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+1),'id'=>'childFN'.($numEnabledChildren+1),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+1),'id'=>'childLN'.($numEnabledChildren+1),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+1), $genderOptions, '', 'id="childG'.($numEnabledChildren+1).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+1),'id'=>'childEM'.($numEnabledChildren+1),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+1),'id'=>'childDOB'.($numEnabledChildren+1),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+1).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Grade*:', 300);
				$gradeOptions1 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+1), $gradeOptions1, '', 'id="childGrade'.($numEnabledChildren+1).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);
			if($accountinfo->getCMBCenter() == "Andover")
			{
				Form::OpenFormItem('Child #'.($numEnabledChildren+1).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
				    echo( form_dropdown('childSession'.($numEnabledChildren+1), $bvSessionOptions, $bvsession, 'id="childSession'.($numEnabledChildren+1).'" style="width: 75px;" ') );			
				Form::CloseFormItem();			
				Spacer::Render(0, 2);
			}
			
           if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+1) . ' Language </br><font size="2" color="red">(only Telugu and Hindi languages are offered in the PM2 language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+1);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+1) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+1);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+1) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+1);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+1) . ' Language:', 300);
                    $langid = 'childLangmw'.($numEnabledChildren+1);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+1) . ' Language Level:', 300);
                    $llid = 'childLangLevelmw'.($numEnabledChildren+1);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			Spacer::Render(0, 20);
			echo('</div>');

			echo('<div id="child2" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+2),'id'=>'childFN'.($numEnabledChildren+2),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+2),'id'=>'childLN'.($numEnabledChildren+2),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+2), $genderOptions, '', 'id="childG'.($numEnabledChildren+2).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+2),'id'=>'childEM'.($numEnabledChildren+2),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+2),'id'=>'childDOB'.($numEnabledChildren+2),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+2).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Grade*:', 300);
				$gradeOptions2 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+2), $gradeOptions2, '', 'id="childGrade'.($numEnabledChildren+2).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);
			if($accountinfo->getCMBCenter() == "Andover")
			{			
				Form::OpenFormItem('Child #'.($numEnabledChildren+2).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
					echo( form_dropdown('childSession'.($numEnabledChildren+2), $bvSessionOptions, $bvsession, 'id="childSession'.($numEnabledChildren+2).'" style="width: 75px;" ') );			
				Form::CloseFormItem();
				Spacer::Render(0, 2);
			}			
            
            if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+2) . ' Language </br><font size="2" color="red">(Telugu and Hindi languages are offered in the 2nd (PM) language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+2);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+2) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+2);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+2) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+2);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+2) . ' Language:', 300);
                    $langid = 'childLang'.($numEnabledChildren+2);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+2) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+2);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			Spacer::Render(0, 20);
			echo('</div>');

			echo('<div id="child3" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+3),'id'=>'childFN'.($numEnabledChildren+3),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+3),'id'=>'childLN'.($numEnabledChildren+3),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+3), $genderOptions, '', 'id="childG'.($numEnabledChildren+3).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+3),'id'=>'childEM'.($numEnabledChildren+3),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+3),'id'=>'childDOB'.($numEnabledChildren+3),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+3).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Grade*:', 300);
				$gradeOptions3 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+3), $gradeOptions3, '', 'id="childGrade'.($numEnabledChildren+3).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);
			if($accountinfo->getCMBCenter() == "Andover")
			{						
				Form::OpenFormItem('Child #'.($numEnabledChildren+3).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
					echo( form_dropdown('childSession'.($numEnabledChildren+3), $bvSessionOptions, $bvsession, 'id="childSession'.($numEnabledChildren+3).'" style="width: 75px;" ') );			
				Form::CloseFormItem();			
				Spacer::Render(0, 2);
			}		
            
            if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+3) . ' Language </br><font size="2" color="red">(Telugu and Hindi languages are offered in the 2nd (PM) language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+3);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+3) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+3);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+3) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+3);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+3) . ' Language:', 300);
                    $langid = 'childLang'.($numEnabledChildren+3);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+3) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+3);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
            Spacer::Render(0, 20);
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			echo('</div>');
			
			echo('<div id="child4" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+4),'id'=>'childFN'.($numEnabledChildren+4),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+4),'id'=>'childLN'.($numEnabledChildren+4),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+4), $genderOptions, '', 'id="childG'.($numEnabledChildren+4).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+4),'id'=>'childEM'.($numEnabledChildren+4),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+4),'id'=>'childDOB'.($numEnabledChildren+4),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+4).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Grade*:', 300);
				$gradeOptions4 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+4), $gradeOptions4, '', 'id="childGrade'.($numEnabledChildren+4).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);
			if($accountinfo->getCMBCenter() == "Andover")
			{						
				Form::OpenFormItem('Child #'.($numEnabledChildren+4).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
					echo( form_dropdown('childSession'.($numEnabledChildren+4), $bvSessionOptions, $bvsession, 'id="childSession'.($numEnabledChildren+4).'" style="width: 75px;" ') );			
				Form::CloseFormItem();			
				Spacer::Render(0, 2);
			}
			
            if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+4) . ' Language </br><font size="2" color="red">(Telugu and Hindi languages are offered in the 2nd (PM) language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+4);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+4) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+4);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+4) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+4);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+4) . ' Language:', 300);
                    $langid = 'childLang'.($numEnabledChildren+4);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+4) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+4);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			Spacer::Render(0, 20);
			echo('</div>');

			echo('<div id="child5" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+5),'id'=>'childFN'.($numEnabledChildren+5),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+5),'id'=>'childLN'.($numEnabledChildren+5),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+5), $genderOptions, '', 'id="childG'.($numEnabledChildren+5).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+5),'id'=>'childEM'.($numEnabledChildren+5),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+5),'id'=>'childDOB'.($numEnabledChildren+5),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+5).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Grade*:', 300);
				$gradeOptions5 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+5), $gradeOptions5, '', 'id="childGrade'.($numEnabledChildren+5).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);			
			if($accountinfo->getCMBCenter() == "Andover")
			{						
				Form::OpenFormItem('Child #'.($numEnabledChildren+5).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
					echo( form_dropdown('childSession'.($numEnabledChildren+5), $bvSessionOptions, $bvsession, 'id="childSession'.($numEnabledChildren+5).'" style="width: 75px;" ') );			
				Form::CloseFormItem();			
				Spacer::Render(0, 2);
			}
			
            if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+5) . ' Language </br><font size="2" color="red">(Telugu and Hindi languages are offered in the 2nd (PM) language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+5);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+5) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+5);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+5) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+5);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+5) . ' Language:', 300);
                    $langid = 'childLang'.($numEnabledChildren+5);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+5) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+5);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
			echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');				
			Spacer::Render(0, 20);
			echo('</div>');

			echo('<div id="child6" style="display: none; ">');
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' First Name*:', 300);
				echo( form_input(array('name'=>'childFN'.($numEnabledChildren+6),'id'=>'childFN'.($numEnabledChildren+6),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Last Name*:', 300);
				echo( form_input(array('name'=>'childLN'.($numEnabledChildren+6),'id'=>'childLN'.($numEnabledChildren+6),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Gender*:', 300);
			$genderOptions = array(''=>'Select','male'=>'Male','female'=>'Female');
				echo( form_dropdown('childG'.($numEnabledChildren+6), $genderOptions, '', 'id="childG'.($numEnabledChildren+6).'" style="width: 75px;" ') );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Email:', 300);
				echo( form_input(array('name'=>'childEM'.($numEnabledChildren+6),'id'=>'childEM'.($numEnabledChildren+6),'style'=>'width: 250px;')) );
			Form::CloseFormItem();
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Date Of Birth*:', 300);
				echo( form_input(array('name'=>'childDOB'.($numEnabledChildren+6),'id'=>'childDOB'.($numEnabledChildren+6),'style'=>'width: 100px;')) );
				echo( '<script type="text/javascript">datePickerController.createDatePicker( { formElements:{"childDOB'.($numEnabledChildren+6).'":"m-sl-d-sl-Y"} } );</script>' );
			Form::CloseFormItem();
			Spacer::Render(0, 3);
			Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Grade*:', 300);
				$gradeOptions6 = array(''=>'Select','Pre-K'=>'Pre-K','K'=>'K','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8','9'=>'9','10'=>'10','11'=>'11','12'=>'12');
				echo( form_dropdown('childGrade'.($numEnabledChildren+6), $gradeOptions6, '', 'id="childGrade'.($numEnabledChildren+6).'" style="width: 75px;"') );
			Form::CloseFormItem();
			Spacer::Render(0, 2);			
			if($accountinfo->getCMBCenter() == "Andover")
			{						
				Form::OpenFormItem('Child #'.($numEnabledChildren+6).' Balavihar Session*: </br><font size="2" color="red">(<b>sessions will be assigned according to availability in each class)</font>', 300);
					$bvSessionOptions6 = array(''=>'Select','AM'=>'AM', 'PM'=>'PM', 'PM2'=>'PM2');
                    echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
					//echo( form_dropdown('childSession'.($numEnabledChildren+6), $bvSessionOptions6, $bvsession, 'id="childSession'.($numEnabledChildren+6).'" style="width: 75px;" ') );			
				Form::CloseFormItem();		
				Spacer::Render(0, 2);
			}
			
            if($accountinfo->getCMBCenter() == "Andover")
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+6) . ' Language </br><font size="2" color="red">(Telugu and Hindi languages are offered in the 2nd (PM) language session)</font>:', 300);
                    $langid = 'childLang'.($numEnabledChildren+6);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+6) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+6);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+6) . ' Language Session:*', 300);
                    $sess = 'childLangSession'.($numEnabledChildren+6);
                    $bvSessionOptions = array(''=>'Select','AM'=>'AM', 'PM'=>'PM');
                    //echo( form_label($bvsession, 'bvsession', 'style="width: 20px;" ') );
                    echo( form_dropdown($sess, $bvSessionOptions, $bvsession, 'id="'.$sess.'" style="width: 75px;" ') );
                Form::CloseFormItem();
            }
            else
            {
                Spacer::Render(0, 10);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+6) . ' Language:', 300);
                    $langid = 'childLang'.($numEnabledChildren+6);
                    $langLevel = array('None'=>'None', 'Gujarati'=>'Gujarati', 'Hindi'=>'Hindi','Kannada'=>'Kannada','Marathi'=>'Marathi','Sanskrit'=>'Sanskrit','Tamil'=>'Tamil','Telugu'=>'Telugu');
                    echo( form_dropdown($langid, $langLevel, '', 'id="'.$langid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);
                Form::OpenFormItemSummary('Child #' . ($numEnabledChildren+6) . ' Language Level:', 300);
                    $llid = 'childLangLevel'.($numEnabledChildren+6);
                    $langLevel = array('None'=>'None', 'beginner'=>'Beginner', 'intermediate'=>'Intermediate','advanced'=>'Advanced');
                    echo( form_dropdown($llid, $langLevel, '', 'id="'.$llid.'" style="width: 100px;"') );
                Form::CloseFormItem();
                Spacer::Render(0, 2);                    
            }
			echo('</div>');
		} //if ((6-$numEnabledChildren) > 0)
		
		//Financial Info
		Spacer::Render(0, 15);
		echo('<b>Financial</b>');
		echo('<hr />');

		if ($accountinfo->getMemberType() != "Life")
		{
			if ($accountinfo->getCMBCenter() == "Andover")
			{
				Form::OpenFormItem('CMB Registration Donation:</br><font size="2" color="red">(includes Balavihar and language classes)</font>', 300);
					echo( form_label('<b>$' . $regAmount .'</b>', 'Level', 'style="width: 20px;" ') );
				Form::CloseFormItem();
/*		
				echo('<div id="bvfee1" style="display: none; ">');
				Form::OpenFormItem('<b>Balavihar fee:</b></br><font size="2" color="red">(one child)</font>', 260);
					echo( form_label('<b>$75</b>', 'Level', 'style="width: 20px;" ') );
				Form::CloseFormItem();
				echo('</div>');
				
				echo('<div id="bvfee2" style="display: none; ">');
				Form::OpenFormItem('<b>Balavihar fee:</b></br><font size="2" color="red">(two or more children)</font>', 260);
					echo( form_label('<b>$150</b>', 'Level', 'style="width: 20px;" ') );
				Form::CloseFormItem();
				echo('</div>');
*/				
			}
			else
			{
				Form::OpenFormItem('CMB Registration Donation:</br><font size="2" color="red">(includes Balavihar and language classes)</font>', 300);
					echo( form_label('$' . $regAmount, 'Level', 'style="width: 20px;" ') );
				Form::CloseFormItem();				
			}
		}
		else
		{
			Form::OpenFormItem('CMB Registration Donation:', 300);
				echo( form_label('$0 (Life Member)', 'Level', 'style="width: 20px;" ') );
			Form::CloseFormItem();			
		}

		Form::OpenFormItem('Make a General Donation to CMB:', 300);
			echo( form_input(array('name'=>'donationamount','id'=>'donationamount','style'=>'width: 100px;')) );
			//$donationOptions = array(''=>'Select','yes'=>'Yes','no'=>'No');
			//echo( form_dropdown('donationopt', $donationOptions, '', 'id="donationopt" style="width: 75px;" onchange="donationChangeHandler();"') );
		Form::CloseFormItem();
		//echo('<div id="donationdisp" style="display: none;">');	
		//Form::OpenFormItem('Donation amount:', 260);
			//$donationAmountOptions = array('50'=>'$50','100'=>'$100','500'=>'$500','1000'=>'$1000','2500'=>'$2500','5000'=>'$5000','10000'=>'$10000');
			//echo( form_dropdown('donationamount', $donationAmountOptions, '', 'id="donationamount" style="width: 75px;"') );
		//Form::CloseFormItem();
		//echo('</div>');				
				
		Spacer::Render(0, 20);
		echo('<b>Feedback</b>');
		echo('<hr />');
		Form::OpenFormItem('Any questions regarding registration or fees, please email us ('.safe_mailto("cmbproject@gmail.com","Registration Questions","").') with your name and phone# and we will contact you.', 640);
			//echo( form_label('Any questions about registration or fees, please email: ' , 'Level', 'style="width: 260px;" ') );
			//echo safe_mailto("cmbproject@gmail.com","Registration Questions","");
		Form::CloseFormItem();
		Spacer::Render(0, 15);
		Form::OpenFormItem('Please provide any feedback (confidential) on how we can improve services and programs:', 260);
			echo( form_textarea(array('name'=>'comments','id'=>'comments','maxlength'=>'8000','rows'=>'15','cols'=>'80','style'=>'width: 400px;')) );
		Form::CloseFormItem();
		
		Spacer::Render(0, 20);
		echo('<hr />');
		echo('<font size="2" color="red">You are finishing the first step of registration to collect all relevant information. To complete your registration you must click the <u>Make Payment</u> button to select a method of payment.  Until the payment for registration is complete your child will not be registered in Balavihar or language classes.</font>');
		echo('</div>');
		
		echo "<script type='text/javascript'>\n";
		echo "var childrenCount = $('numChildren').options[$('numChildren').selectedIndex].value\n";	

		echo "var existChildCount = $numEnabledChildren;\n";
		echo "if (childrenCount == '') {\n";
		echo "childrenCount = 0; }\n";
		echo "for( var i = 1; i <= 6; i++ ) {\n";
		echo "if( i <= childrenCount ) {\n";
		echo "$('child' + i).show(); }\n";
		echo "else {\n";
		echo "$('child' + i).hide(); }\n";
		echo "}\n";
		echo "if ((childrenCount + existChildCount) == 0) {\n";
		echo "$('bvfee1').hide();\n";
		echo "$('bvfee2').hide(); }\n";
		echo "if ((childrenCount + existChildCount) == 1) {\n";
		echo "$('bvfee1').show();\n";
		echo "$('bvfee2').hide(); }\n";
		echo "if ((childrenCount + existChildCount) > 1) {\n";
		echo "$('bvfee1').hide();\n";
		echo "$('bvfee2').show(); }\n";
		echo "</script>";		

	echo( form_close() );
?>
	
	<div class="form-button-container">
		<?php if($this->config->item('debug')){ ?><a href="javascript: populate();">Populate</a><?php } ?>
		<a href="javascript: validate();"><img src="<?php echo( base_url() );?>assets/images/buttons/make_payment.gif" border="0" onmouseover="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmousedown="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmouseup="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" onmouseout="this.src = '<?php echo( base_url() );?>assets/images/buttons/make_payment.gif';" /></a>
	</div>

</div>

<script type="text/javascript">
	function validate()
	{
		var urlKey =  "<?php echo $urlKey ?>";
		new Ajax.Request(baseUrl + 'validation/member_registration_validation/validate_register_existing_member/'+urlKey, 
		{
			method:'post',
			parameters: Form.serialize( $('registerExistingForm') ),
		  	onSuccess: function(response)
			{
				var result = response.responseText;
				
				if( result == 'VALIDATION_SUCCESS' )
				{
					$('registerExistingForm').submit();
				}
				else
				{
					$('validationErrors').innerHTML = result;
					$('validationErrors').show();
					Effect.ScrollTo('validationErrors', { duration:'0.2', offset:-20 });
				}
			},
			onFailure: function(response){var result = response.responseText; $('validationErrors').innerHTML = result;
					$('validationErrors').show();alert('failed') }
		});
	}

	function numChildrenChangeHandler()
	{
		var childrenCount = $('numChildren').options[$('numChildren').selectedIndex].value;
		var tempCount =  "<?php echo $numEnabledChildren ?>";
		var existChildCount = parseInt(tempCount);
		
		if(childrenCount == "")
		{
			childrenCount = 0;
		}
		
		for( var i = 1; i <= 6; i++ )
		{
			if( i <= childrenCount )
			{
				$('child' + i).show();
			}
			else
			{
				$('child' + i).hide();
			}
		}
		
		if ((childrenCount + existChildCount) == 0)
		{
			$('bvfee1').hide();
			$('bvfee2').hide();
		}

		if ((childrenCount + existChildCount) == 1)
		{
			$('bvfee1').show();
			$('bvfee2').hide();
		}

		if ((childrenCount + existChildCount) > 1)
		{
			$('bvfee1').hide();
			$('bvfee2').show();
		}
	}

	function donationChangeHandler()
	{
		var $donate = $('donationopt').options[$('donationopt').selectedIndex].value;
		if ($donate == "yes")
		{
			$('donationdisp').show();
		}
		else
		{
			$('donationdisp').hide();
		}
	}
	
</script>

<?php if($this->config->item('debug')){ ?>
<script type="text/javascript">
	function populate()
	{
		/* 
		$('userName').value = 'john.doe';
		$('password').value = 'registerthis';
		*/
		$('firstName').value = 'John'
		$('lastName').value = 'Doe'
		$('gender').selectedIndex = 1;
		$('primaryEmail').value = 'john.doe@email.com';
		$('homePhoneNumber').value = '555-555-5555';
		$('mobilePhoneNumber').value = '';
		$('homeAddress1').value = '123 Sunset Blvd';
		$('homeAddress2').value = '';
		$('city').value = 'Lexington'
		$('state').selectedIndex = 22;
		$('zipCode').value = '02421';
	}
</script>
<?php } ?>